{% extends 'base/base_table.html' %}

{% block title %}ITAdmin | 终端连接{% endblock %}

{% block table_thead %}
     <tr>
        <th>主机名</th>
        <th>所在机房</th>
        <th>内网IP</th>
        <th>外网IP</th>
        <th>连接</th>
     </tr>
{% endblock %}

{% block table_bady %}
    {% for object in objects %}
        <tr>
             <td>{{ object.name }}</td>
             <td>{{ object.generatorroom.name }}</td>
             <td>{{ object.get_vlan_ip }}</td>
             <td>{{ object.get_wan_ip }}</td>
             <td>
                 <a class="btn btn-info " type="button" href="{% url 'host_connect' %}?host={{ object.get_wan_ip }}&&user=root&&port={{ object.ssh_port }}&&server={{ object.name }}">
                     <i class="fa fa-laptop"></i> 连接
                 </a>
             </td>
        </tr>
    {% endfor %}
{% endblock %}

{% block script %}
<script type="text/javascript">


    $(function () {

        $('#pages').val('{{ entry }}')
        $('#pages').change(function () {
            var search = '{{ search }}'
            if (search == '') {
                location.href = "{% url 'terminal' %}?page={{ num }}&entry=" + $(this).val();
            } else {
                location.href = "{% url 'terminal' %}?page={{ num }}&{{ search }}&entry=" + $(this).val();
            }
        });
    });
</script>
{% endblock %}